﻿using System;

namespace Kiln.Net.Samples {
    class Program {
        static void Main() {

            Console.Write("Account: ");
            var account = Console.ReadLine();

            Console.Write("User: ");
            var user = Console.ReadLine();

            Console.Write("Password: ");
            var password = Console.ReadLine();

            using (Kiln myAccount = Kiln.AuthenticateOnDemand(account, user, password)) {
                
                // Each example is shown in two ways. Basically,
                // they are equal but the second one is more "low-level".

                // Returns repository with ID equal 1
                Repository repo;
                repo = myAccount.GetRepo(1);
                repo = myAccount.Call<Repository>(KilnApiCall.Repo, new { ixRepo = 1 });

                // Returns the list of all repositories
                Person[] persons;
                persons = myAccount.GetPersons();
                persons = myAccount.Call<Person[]>(KilnApiCall.Persons, new { });

                // Returns the list of all available projects
                Project[] projects;
                projects = myAccount.GetProjects();
                projects = myAccount.Call<Project[]>(KilnApiCall.Projects, null);

                // Deletes project with specified ID
                //bool deleteSucceeded;
                //deleteSucceeded = myAccount.DeleteProject(1);
                //deleteSucceeded = myAccount.Call<bool>(KilnApiCall.ProjectDelete, new { id = 1 });
            }
        }
    }
}
